<?php

abstract class Core_Backend_Share_View_Form extends Dcmp_Component_View {

    protected $form = NULL;
    protected $toolbar = NULL;
    protected $navigation = NULL;
    
    public function __construct($component){
        $this->form = new Core_Html_Form();
        $this->toolbar = new Kd_Html_Toolbar();
        $this->navigation = new Kd_Html_Navigation();
        parent::__construct($component);
    }
    
    protected function initialize(){
    	$this->setTemplatePath(Kd_Util_IO::findFile($this->getDomain()->getConfig()->getSetting('templateDirectories'), 
    						   'component'.DS.'share'.DS.'form.phtml'));    	
    }

    public function getForm(){
        return $this->form;
    }

    public function getToolbar(){
        return $this->toolbar;
    }

    public function getNavigation(){
        return $this->navigation;
    }

    protected function buildForm($form){
        $form->addHiddenField('token', 'token', md5(time()));
    }

    protected function buildToolbar($toolbar){}

    protected function buildNavigation($navigation){}
    
    public function render(){
        $this->buildForm($this->form);
        $this->buildToolbar($this->toolbar);
        $this->buildNavigation($this->navigation);
        $this->getTemplate()->assign('form', $this->getForm())
                            ->assign('toolbar', $this->getToolbar())
                            ->assign('navigation', $this->getNavigation());
        return parent::render();
    }    
}